from zonghe.caw.file_reader import read_config, read_yaml
from zonghe.caw.base_request import BaseRequest


def register(url,test_request,cs):
    """

    :param url: 测试环境
    :param test_request: BaseRequest的实例
    :param cs: 请求参数
    :return: 注册接口相应
    """
    url=url+"/futureloan/mvc/api/member/register"
    r=test_request.post(url,data=cs)
    return r
def login(url,test_request,cs):
    """

    :param url: 测试环境
    :param test_request: BaseRequest的实例
    :param cs: 请求参数
    :return: 注册接口相应
    """
    url=url+"/futureloan/mvc/api/member/login"
    r=test_request.post(url,data=cs)
    return r
def recharge(url,test_request,cs):
    url = url + "/futureloan/mvc/api/member/recharge"
    r = test_request.post(url, data=cs)
    return r
if __name__ == '__main__':
    cs={
    "mobilephone": "",
    "pwd": ''
    }
    register("http://192.168.151.6:8080",BaseRequest(),cs)
    for y1 in read_yaml("register_fail_data.yaml"):
        register(read_config("base_url"),BaseRequest(),y1)